#include <vector>

#include "uint.h"
#include "cCompressor3BPP.h"

using namespace std;

/* PROTECTED: Decompresses from this->file or this->data
 * Returns: Decompressed data
 */
u32 Compressor3BPP::_Decompress(u8* out, u32 size)
{
	u32 pos = 0, outpos = 0;
	//u8 temp[8];
	u8 byte1, byte2;
	
	while(outpos < size)
	{
		for (int x=0;x<8;x++)
		{
			byte1 = GetByte(pos++);
			byte2 = GetByte(pos++);
			out[outpos++] = byte1;
			if(outpos >= size) break;
			out[outpos++] = byte2;
			if(outpos >= size) break;
			//temp[x] = byte1 | byte2;
		}

		for (int x=0;x<8;x++)
		{
			byte1 = GetByte(pos++);
			out[outpos++] = byte1;
			if(outpos >= size) break;
			out[outpos++] = 0; //byte1 | temp[x]; //I don't know either
			if(outpos >= size) break;
		}
	}

	//DebugOut(DO_ALL, "pos=%u\n", outpos);
	return outpos;
}

u32 Compressor3BPP::_Compress(u8* out, u32 size)
{
	throw new UnimplementedException();
}
